package org.example.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.example.domain.query.report.*;
import org.example.domain.vo.report.account.AccountBillVO;
import org.example.domain.vo.report.account.BaseAccountHead;
import org.example.domain.vo.report.account.ErpAccountVO;
import org.example.domain.vo.report.account.detail.data.Payment;
import org.example.domain.vo.report.account.detail.data.Transfer;
import org.example.domain.vo.report.allocate.AllocateDepot;
import org.example.domain.vo.report.inDetail.Menyimpan;
import org.example.domain.vo.report.inOutStockReport.InOutStockReport;
import org.example.domain.vo.report.materialStock.ErpMaterialStockVO;
import org.example.domain.vo.report.ErpReport;
import org.example.domain.vo.report.materialStock.InventoryFlows;
import org.example.domain.vo.report.materialStock.billDetail.data.SaleIn;
import org.example.domain.vo.report.retail.RetailStatistics;
import org.example.domain.vo.report.stock_warning.StockWarningReport;
import org.example.domain.vo.report.summary.StorageSummary;

import java.util.List;

public interface ErpReportMapper extends BaseMapper<ErpReport> {
    
    /**
     * 查询商品库存
     */
    Page<ErpMaterialStockVO> findMaterialStock(Page<ErpReport> page, @Param("stockQuery") StockQuery stockQuery);
    
    IPage<InventoryFlows> findMaterialBill(Page<ErpReport> page, @Param("query")MaterialBillQuery query);
    
    /**
     * 查询商品销售出库流水详情
     * @param headNumber 订单编号
     */
    SaleIn getSaleBillDetail(@Param("headNumber") String headNumber);
    
    /**
     * 查询商品零售出库流水
     * @param number 订单编号
     */
    SaleIn getRetailDetail(@Param("number") String number);

    IPage<ErpAccountVO> pageFindAccount(Page<ErpReport> page,@Param("accQuery") AccQuery accQuery);

    List<AccountBillVO> findAccountBill(@Param("accId") Long accId, @Param("tenantId") Long tenantId);
    
    Payment getAccountHeadDetail1(@Param("tenantId") Long tenantId, @Param("headNumber") String headNumber);
    
    Transfer getAccountHeadDetail2(@Param("tenantId") Long tenantId, @Param("headNumber") String headNumber);
    
    IPage<RetailStatistics> findRetailStatistics(Page<RetailStatistics> page, @Param("query") RetailStatisticsQuery query);
    
    IPage<RetailStatistics> findPurchaseStatistics(Page<RetailStatistics> page, @Param("query") RetailStatisticsQuery query);
    
    IPage<RetailStatistics> findSaleStatistics(Page<RetailStatistics> page, @Param("query") RetailStatisticsQuery query);
    
    IPage<Menyimpan>findMenyimpanPage(Page<Menyimpan> page, @Param("query") InDetailQuery inDetailQuery);
    
    IPage<StorageSummary> findStorageSummaryPage(Page<StorageSummary> page, @Param("query") StorageSummaryQuery query);
    
    IPage<InOutStockReport> findInOutStockReportPage(Page<InOutStockReport> page, @Param("query") InOutStockReportQuery query);
    
    IPage<AllocateDepot> findAllocateDepotPage(Page<AllocateDepot> page, @Param("query") AllocateDepotQuery query);
    
    IPage<StockWarningReport> findStockWarning(Page<StockWarningReport> page, @Param("query") InOutStockReportQuery query);
}
